<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAddressesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('addresses', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->index()->comment('地址所属用户编号');
            $table->string('name')->comment('收件人姓名');
            $table->string('phone')->comment('收件人电话');
            $table->string('area')->comment('收货地址省市区信息');
            $table->string('detail')->comment('详细收货地址信息');
            $table->boolean('is_default')->default(0)->comment('是否默认地址');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('addresses');
    }
}
